<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../common/common.jsp"%>   
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
        <link rel="stylesheet" href="${ctx }/css/layui.css">
		<script type="text/javascript" src="${ctx }/js/layer-v1.9.2/layer/layer.js"></script>
        <script type="text/javascript" src="${ctx}/js/layer-v1.9.2/layer/layui.js"></script>
		<script src="${ctx }/js/order/address.js"></script>
		<script src="${ctx}/js/order/confirm_order.js"></script>
		<script src="${ctx }/js/order/express.js"></script>
		<title>确认订单</title>
	</head>
	<body>
	<div class="addr_same container">
			<input type="hidden" value="${requestScope.id} "/>
			<div class="top">
				<a href="${ctx }/" class="logo"><img src="${ctx }/images/logo.png" alt="LOGO" /></a>
				<div class="r">
					<img src="${ctx }/images/qr.png" alt="" />
				<!-- 	<p>
						<span class="red">购物车</span>
						<span class="red">确认订单</span>
						<span>支付</span>
						<span class="last">完成</span>
					</p> -->
				</div>
			</div>
			
			<div class="select_addr">
				<p class="f22 three big">选择收货地址</p>
				<div class="clearfix" id="addressList">
				</div>
				<p class="manage">
					<a href="${ctx}/member/vip_set_address" target="_blank" class="three">管理收货地址</a>
					<a href="javascript:showForm();"  class="red">使用新地址</a>
				</p>
			</div>
			<div id="addAdress" style="display:none">
			
				<form action="" class="three" id="form">
					<input type="hidden" name="province" id="province">
					<input type="hidden" name="city" id="city">
					<input type="hidden" name="county" id="county">
					<input type="hidden" name="mId" id="mId">
					<input type="hidden" name="maId" id="maId">
					<p class="province">
						<label for="">省：<i>*</i></label>
						<select name="provinceCode" id="provinceCode">
						</select>
						<span>市:</span>
						<select name="cityCode" id="cityCode">
						</select>
						<span>区：</span>
						<select name="countyCode" id="countyCode">
						</select>
					</p>
					<p><label for="">邮政编码：<i>*</i></label><input type="text" name="postcode" id="postcode"/></p>
					<p class="street_addr"><label for="">街道地址：<i>*</i></label><textarea name="street" rows="" cols="" id="street"></textarea></p>
					<p class="prompt nine">请填写街道地址，最少5个字，最多不能超过100个字</p>
					<p><label for="">收货人姓名：<i>*</i></label><input type="text" name="name" id="name" /></p>
					<p><label for="">手机：<i>*</i></label><input type="tel" name="tel" id="tel"/></p>
					<div class="item item-set-default" id="j_ItemSetDefault">
						<input type="checkbox" value="1" class="i-chk" name="isdefault" id="J_SetDefault"> 
						<label for="J_SetDefault" class="tsl" data-phase-id="d_p_saveAsDefaultAddress" id="ss">设置为默认收货地址</label>
					</div>
					<p class="btn clearfix"><a  class="confirm f14" id="confirmAddAddress">确认地址</a><a onclick="cancle()" class="cancel f14" >取消</a></p>
					
				</form>
			</div>
			<div class="confirm_info three">
				<p class="f22 big">确认商品信息</p>
				<div class="same_w a">
					<span class="a">商品</span>
					<span class="b">商品信息</span>
					<span class="c">单价(元)</span>
					<span class="d">数量</span>
					<span class="e">优惠</span>
					<span class="f">小计</span>
				</div>
					<c:forEach var="shops" items="${shops}">
						<div class="nine shop b">
		                     <input type="hidden" id="sellerId" value="${shops.sellerId}" />
						        店铺：<span class="three">${shops.shopName }</span><%-- <i class="three"><img src="${ctx }/images/talk.png" alt="联系客服" />&nbsp;联系客服</i> --%>
							<c:forEach var="product" items="${shops.products}">
							<div class="same_w c" id="${product.productId }" goods_sku_id="${product.goods_sku_id }" >
								<span class="a">
									<img src="${product.picture }" alt="${product.productName }" />
									<p class="r">${product.productName }</p>
								</span>
								
								<c:set value="${product.goods_sku_info}" var="skuInfo"/>								    
								<c:choose>
								    <c:when test="${skuInfo != null and skuInfo != '' and fn:length(fn:split(skuInfo,',')) > 0 }">	
							             <c:set value="${fn:split(skuInfo,',')}" var="skuInfoArr"/>
								         <span class="b"  >									       
							             <c:forEach var="sku" items="${skuInfoArr }">								             
								           <p>${sku}</p>
							             </c:forEach>
							             </span>
								    </c:when>
								    <c:otherwise>
								         <span>无规格商品</span>
								    </c:otherwise>
								</c:choose>	
								 <c:choose>
								    <c:when test="${product.discountMarketPrice != null}">
								      <span class="c">
								      	<!-- <s>1735.00</s> -->
								       <p class="unit_price">${product.discountMarketPrice}</p>	
								       </span>	
								    </c:when>
								    <c:otherwise>
								     <span class="c">
								       <p class="unit_price">${product.marketPrice}</p>	
								       </span>
								    </c:otherwise>
								</c:choose>	
								<span class="count d">
									<!-- <span class="minus">-</span> -->
									<%-- <input type="text" value="${product.quantity}" disabled="disabled"/> --%>
									<p class="mWord">${product.quantity}</p>	
									<!-- <span class="add">+</span> -->
								</span>
								<c:if test="${fn:length(product.goodsProMapList) > 0 }">	
										 <select  id="goodsSalePromotion"  name="goodsSalePromotion"  sellerId="${shops.sellerId }">	
	                                          <option value="">不参与该活动</option>
											 <c:forEach var="goodsPro" items="${product.goodsProMapList }">					 
											     <option value="${goodsPro.proDetailId }"
													    goodsId="${goodsPro.productId }" 
													    proType="${goodsPro.proType }"  
													    mustQuantity = "${goodsPro.mustQuantity }"  
													    discountAmount = "${goodsPro.discountAmount }"
													    discountRate = "${goodsPro.discountRate }"
													    giftGoods ="${goodsPro.giftGoods }">
												      ${goodsPro.proDetailTitle }</option>
										      </c:forEach>									 
										 </select>
								</c:if>	
								<c:if test="${fn:length(product.goodsProMapList) == 0  }">								
								    <span class="red e" style="width:160px">无</span>
								</c:if>	
								 <c:choose>
								    <c:when test="${product.discountMarketPrice != null}">
							           <span class="red f price">${product.discountMarketPrice*product.quantity}</span>	
								    </c:when>
								    <c:otherwise>
							           <span class="red f price">${product.marketPrice*product.quantity}</span>	
								    </c:otherwise>
								</c:choose>	
							</div>		
					    </c:forEach>	
						<div class="d">
							<p>买家备注：<input type="text" name ="memeo" id ="memeo"  placeholder="选填:对本次的交易说明"/>
							<%-- 
							<c:set value="${shops.promotions}" var="shopPromotions"/>					
						    <c:set value="${promotions}" var="goodsPromotions"/>
						    <c:if test="${fn:length(shopPromotions) > 0 or fn:length(goodsPromotions) >0 }">			
								 <c:if test="${ fn:length(shops.promotions) >1 }">
									 <label for="" >店铺优惠</label>
									 <select id="wholeOrderPromotion"  name="wholeOrderPromotion"  sellerId="${shops.sellerId }">
                                         <option value="">不参与该活动</option>
									     <c:forEach var="shopPro" items="${shops.promotions }">									 
											 <option value="${shopPro.proDetailId }" 
											         proType="${shopPro.proType }"
													 mustQuantity = "${shopPro.mustQuantity }"  
													 discountAmount = "${shopPro.discountAmount }"
													 discountRate = "${shopPro.discountRate }">
											 ${shopPro.proDetailTitle }</option>
										 </c:forEach>										
									</select>
								 </c:if>	
						     </c:if>				 --%>
							 <label for="" >选择快递方式</label>
							<select id="expressList" class="expressList">								
							</select>
							<span class="r " style="margin-top:5px;margin-right: 100px;color: #999;"> <label for="" >快递运费：</label><i class="red expressFee">0.00</i></span></p>
						</div>
						<div class="f clearfix" style=" margin-bottom: 5px;">
							<span class="r clearfix" >共有<i class="red sum">${shops.itemnum }</i>件商品，优惠了<i class="red promotion_money">0</i>元，店铺合计(含运费)：<i class="red total_price f16">￥${shops.totalAmount }</i></span>
						</div>
						
						</div>
				   </c:forEach>
					<div class="f clearfix" style="margin-top: 5px;border-top: 1px solid #ece2e2;">
					    <span class="back"><img src="${ctx }/images/back.png" alt="返回" /><a href="${ctx }/cart/cartPage?cartType=all">返回购物车</a></span>					
					    <input type="hidden" name="expressId" id="expressId"/>
					    <input type="hidden" name="addressId" id="addressId"/>
					    <input type="hidden" name="source" id="source"/>
					    <span class="r clearfix">共有<i class="red sum">${totalItemnum }</i>件商品，优惠了<i class="red promotion_totalAmount_money">0</i>元，总计：<i class="red totalAmount f22" id="allTotalAmount">￥${totalAmount }</i><button class="payment f22">提交订单</button></span>					
					</div>
					
			</div>
		</div>
		<!--底部-->
		<%@include file="../common/bottom.jsp"%>
	</body>
</html>
